<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function foo(){
            console.log(this.a);
        }

        function doFoo(fn){
            fn();       //hahaha
            console.log("--------直接通过obj.foo调用---------")
            obj.foo();  //2
        }

        var obj = {
            a:2,
            foo
        }

        var a = "hahaha"

        doFoo(obj.foo)
        // 实际上这也是一个引用传递导致的隐式丢失
    </script>
</body>
</html>